package com.ctshk.rpc.order.tour.enums;

/**
 * 旅行团 订单详情 状态码转换枚举类
 *
 * @author lys
 * @date 2021/06/07
 */
public enum IsPayStatusCode {

    /**
     * 支付状态
     */
    PENDING_PAYMENT(0, 0, "待付款"),
    RECEIVED_PAYMENT(1, 1, "已付款"),
    ;

    /**
     * 数据库状态码
     */
    private Integer oldCode;
    /**
     * 前台显示状态码
     */
    private Integer newCode;
    /**
     * 前台显示状态码对应信息
     */
    private String msg;

    IsPayStatusCode(Integer oldCode, Integer newCode, String msg) {
        this.oldCode = oldCode;
        this.newCode = newCode;
        this.msg = msg;
    }

    public Integer getOldCode() {
        return oldCode;
    }

    public void setOldCode(Integer oldCode) {
        this.oldCode = oldCode;
    }

    public Integer getNewCode() {
        return newCode;
    }

    public void setNewCode(Integer newCode) {
        this.newCode = newCode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static Integer getNewStatusCode(Integer oldCode) {
        IsPayStatusCode[] values = IsPayStatusCode.values();
        for (IsPayStatusCode value : values) {
            if (oldCode.intValue() == value.getOldCode().intValue()) {
                return value.getNewCode();
            }
        }
        return null;
    }

}
